package com.learn.springboot.dao.request.base;

import java.util.ArrayList;
import java.util.List;

import com.learn.springboot.service.utils.ConverterUtil;

/**
 * @author suzheng
 * @date 2024-05-17
 **/
public abstract class Converter<T, E> {
    public abstract T convertFrom(E src);

    public List<T> convertList(List<E> srcList) {
        if (srcList == null || srcList.isEmpty()) {
            return new ArrayList<T>();
        }
        return ConverterUtil.convertList(srcList, this);
    }

    public boolean isValid(E obj) {
        return obj != null;
    }


}